{[{define "sys/dict/edit.html"}]}
{[{template "sys/base/mark.html"}]}
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改页面</title>
    <link rel="stylesheet" href="/pear-admin-layui/component/pear/css/pear.css"/>
</head>
<body>
<form class="layui-form" action="">
    <input type="hidden" name="id" value="{[{.id}]}">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label">typeName</label>
                <div class="layui-input-block">
                    <input type="text" name="typeName" autocomplete="off" placeholder="typeName"
                           lay-verType="tips" value="{[{.typeName}]}" lay-verify="required" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">typeCode</label>
                <div class="layui-input-block">
                    <input type="text" name="typeCode" autocomplete="off" placeholder="typeCode"
                           lay-verType="tips" value="{[{.typeCode}]}" lay-verify="required" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">remark</label>
                <div class="layui-input-block">
                    <textarea name="remark" placeholder="请输入内容" class="layui-textarea">{[{.remark}]}</textarea>
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="edit">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="/pear-admin-layui/component/layui/layui.js"></script>
<script src="/pear-admin-layui/component/pear/pear.js"></script>
<script>
    layui.use(['form', 'jquery', 'loading'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let loading = layui.loading;

        form.on('submit(edit)', function (data) {
            loading.Load(1, "loading data ...");
            $.post('/sys/dict/edit', data.field, function (r) {
                loading.loadRemove(1000);
                if (r.code === 200) {
                    layer.msg(r.msg, {icon: 1, time: 1000}, function () {
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                        parent.layui.table.reload("dict-type-table");
                    });
                } else {
                    layer.msg(r.msg, {icon: 2, time: 1000});
                }
            });
            return false;
        });
    })
</script>
<script>
</script>
</body>
</html>
{[{end}]}